package com.heima.wemedia.controller;

import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.wemedia.dtos.WmSensitiveDto;
import com.heima.model.wemedia.dtos.WmQuerySensitiveDto;
import com.heima.wemedia.service.WmSensitiveService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


/**
 * 类功能描述：敏感词业务层
 *
 * @author sungang
 * @date 2024/01/25  09:58
 */
@RestController
@RequestMapping("api/v1/sensitive/")
public class WmSensitiveController {
    @Autowired
    private WmSensitiveService wmSensitiveService;

    /**
     * 功能描述：分页查询敏感词
     *
     * @param wmSensitiveDto
     * @return {@link ResponseResult }
     * @author sungang
     * @date 2024/01/25  09:58
     */

    @PostMapping("list")
    public ResponseResult querySensitives(@RequestBody WmQuerySensitiveDto wmSensitiveDto) {
        return wmSensitiveService.querySensitives(wmSensitiveDto);
    }

    /**
     * 功能描述：添加敏感词
     *
     * @param wmSaveSensitiveDto
     * @return {@link ResponseResult }
     * @author sungang
     * @date 2024/01/25  11:12
     */

    @PostMapping("save")
    public ResponseResult saveSensitives(@RequestBody WmSensitiveDto wmSaveSensitiveDto){
        return wmSensitiveService.saveSensitives(wmSaveSensitiveDto);
    }

    /**
     * 功能描述：删除敏感词
     *
     * @param id
     * @return {@link ResponseResult }
     * @author sungang
     * @date 2024/01/25  11:34
     */

    @DeleteMapping("del/{id}")
    public ResponseResult deleteSensitives(@PathVariable Integer id){
        return wmSensitiveService.deleteSensitives(id);
    }

    /**
     * 功能描述：修改敏感词
     *
     * @param wmSensitiveDto
     * @return {@link ResponseResult }
     * @author sungang
     * @date 2024/01/25  11:50
     */

    @PostMapping("update")
    public ResponseResult updateSensitives(@RequestBody WmSensitiveDto wmSensitiveDto){
       return  wmSensitiveService.updateSensitives(wmSensitiveDto);
    }
}
